The invention relates to a method for operating a camera device for a motor vehicle. A raw image of an environment of the camera device is provided by an image sensor of the camera device. By an image processing device, an output image is generated from the raw image based on histogram spreading. A camera device for performing the method as well as a motor vehicle with the camera device are also associated with the invention.
In generating a raw image by means of an image sensor, this raw image can have an undesirably low dynamic range. If the raw image for example has pixels, the pixel values of which are each represented by 8 bits per color value or 8 bits for the luminance value or brightness value, thus, each pixel for each color or for the brightness can virtually have 256 different values in total, for example pixel values from 0 to 255. In a raw image of the image sensor, there is correspondingly a darkest pixel, the pixel value of which is smallest, and a brightest pixel, the pixel value of which is greatest. The value interval limited by the darkest pixel and the brightest pixel represents the dynamic range of the raw image. For example, if the darkest pixel has a brightness value of 30 and the brightest pixel has a brightness value of 120, thus, the raw image has a dynamic from 30 to 120. This is lower than the maximally possible dynamic range extending from 0 to 255 (with 8-bit pixel values).
In order to improve the dynamic range, the histogram spreading is known, which determines from a respective input pixel value of each pixel of the raw image each one output pixel value of a corresponding pixel of an output image by means of a spreading function. Then, the output image can be further used instead of the raw image. In the prior art, it is known to design the spreading function such that the darkest pixel, in the example the value 30, is mapped to the value 0. The brightest pixel, in the example the value 120, is mapped to the maximally possible pixel value, thus for example 255. Between the darkest pixel and the brightest pixel, then, it is interpolated by the spreading function, for example by a linear interpolation or by a so-called S-curve. By the histogram spreading, the image contrast in the output image improves compared to the raw image.
In using a camera device for a motor vehicle, the image contrast is not crucial in all situations. One has observed situations, in which the recognizability of image regions was deteriorated by the improvement of the image contrast by means of histogram spreading. This entails that a driver of a motor vehicle can no longer use the camera device as an assistance to for example park the motor vehicle. In particular, one has ascertained that with particularly low ambient light, thus, if the brightness of the environment of the motor vehicle is below a predetermined threshold value, by the histogram spreading, image areas in the raw image, which are already relatively dark, are further darkened by the histogram spreading. Then, the driver can no longer recognize image details in the output image.
Current vision systems may enable histogram stretching to an image as a simple enable disable function.